package com.dmm.vod.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.dmm.result.Result;
import com.dmm.vod.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "文件上传接口")
@RestController
@RequestMapping("/vod/file")
@CrossOrigin
public class FileController {

    @Autowired
    FileService fileService;


    @ApiOperation("文件上传")
    @PostMapping("/upload")
    public Result upload(@ApiParam(name = "file", value = "文件", required = true)
                             @RequestParam("file") MultipartFile file){

        String url  = fileService.upload(file);

        return Result.success(url);
    }
}
